<?php
include 'DB.php';

$config = [
    'host' => '127.0.0.1',
    'user' => 'root',
    'password' => 'root',
    'database' => 'php8_rainy',
    'charset' => 'utf8'
];

try {
    $db = new \database\DB($config);
    // $db->execute("insert into news set title=?,author=?", ['2021', 'Java']);
    //
    // $data = $db->query("select * from news where id>=:id", [':id' => 1]);
    // print_r($data);

    // $rows = $db->table('news')->field('title', 'author')->limit(1)->get();
    // print_r($rows);
    // $db->table('news')->where('id = 1')->update(['title' => '去哪儿', 'author' => 'zc']);
    $db->table('news')->where('id = 4')->delete();
} catch (\Exception $exception) {
    echo $exception->getMessage();
}
